package behavioral_pattern.command_pattern.test1;

/**
 * 功能键类：请求发送者
 */
public class FunctionButton {

    protected String name;
    protected Command command;

    public FunctionButton(String name) {
        this.name = name;
    }
    /**
     * 为功能注入命令
     */
    public void setCommand(Command command){
        this.command = command;
    }

    /**
     * 发送请求方法
     */
    public void onClick(){
        System.out.print("点击功能键:");
        command.execute();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
